home *** CD-ROM | disk | FTP | other *** search
/ Revista do CD-ROM 101 / CD-ROM 101.iso / compl / maya5ple / Install_MayaPLE5_English.exe / Maya / Data1.cab / generateChannelMenu.mel < prev    next >
Encoding:
Text File  |  2003-07-17  |  21.9 KB  |  684 lines

  1. // Copyright (C) 1997-2002 Alias|Wavefront,
  2. // a division of Silicon Graphics Limited.
  3. //
  4. // The information in this file is provided for the exclusive use of the
  5. // licensees of Alias|Wavefront.  Such users have the right to use, modify,
  6. // and incorporate this code into other products for purposes authorized
  7. // by the Alias|Wavefront license agreement, without fee.
  8. //
  9. // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  10. // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
  11. // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  12. // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
  13. // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  14. // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  15. // PERFORMANCE OF THIS SOFTWARE.
  16. //
  17. global proc channelBoxCommand( string $operation )
  18. //
  19. {
  20.     switch( $operation ) {
  21.         case "-key":
  22.             channelBox -e -exe "setKeyframe \"#P.#A\";" true mainChannelBox;
  23.             break;
  24.         case "-keyall":
  25.             channelBox -e -exe "setKeyframe \"#P.#A\";" false mainChannelBox;
  26.             break;
  27.         case "-breakdown":
  28.             channelBox -e -exe "setKeyframe -breakdown true \"#P.#A\";" true mainChannelBox;
  29.             break;
  30.         case "-breakdownall":
  31.             channelBox -e -exe "setKeyframe -breakdown true \"#P.#A\";" false mainChannelBox;
  32.             break;
  33.         case "-mute":
  34.             channelBox -e -exe "mute \"#P.#A\";" true mainChannelBox;
  35.             break;
  36.         case "-muteall":
  37.             channelBox -e -exe "mute \"#P.#A\";" false mainChannelBox;
  38.             break;
  39.         case "-unmute":
  40.             channelBox -e -exe "mute -disable \"#P.#A\";" true mainChannelBox;
  41.             break;
  42.         case "-unmuteall":
  43.             channelBox -e -exe "mute -disable \"#P.#A\";" false mainChannelBox;
  44.             break;
  45.         case "-lock":
  46.             channelBox -e -exe "setAttr -lock true \"#P.#A\";" true mainChannelBox;
  47.             break;
  48.         case "-unlock":
  49.             channelBox -e -exe "CBunlockAttr \"#P.#A\";" true mainChannelBox;
  50.             break;
  51.         case "-expression":
  52.             {
  53.                 string $objList[] = `channelBox -q -mainObjectList mainChannelBox`;
  54.                 string $attrList[] = `channelBox -q -selectedMainAttributes mainChannelBox`;
  55.  
  56.                 if ( size($objList) > 0 && size($attrList) > 0 ){
  57.                     expressionEditor "EE" $objList[0] $attrList[0];
  58.  
  59.                 } else {
  60.                     $objList = `channelBox -q -shapeObjectList mainChannelBox`;
  61.                     $attrList = `channelBox -q -selectedShapeAttributes mainChannelBox`;
  62.  
  63.                     if ( size($objList) > 0 && size($attrList) > 0 ){
  64.                         expressionEditor "EE" $objList[0] $attrList[0];
  65.  
  66.                     } else {
  67.                         $objList = `channelBox -q -historyObjectList mainChannelBox`;
  68.                         $attrList = `channelBox -q -selectedHistoryAttributes mainChannelBox`;
  69.  
  70.                         if ( size($objList) > 0 && size($attrList) > 0 ){
  71.                             expressionEditor "EE" $objList[0] $attrList[0];
  72.                             
  73.                         } else {
  74.                             $objList = `channelBox -q -outputObjectList mainChannelBox`;
  75.                             $attrList = `channelBox -q -selectedOutputAttributes mainChannelBox`;
  76.  
  77.                             if ( size($objList) > 0 && size($attrList) > 0 ){
  78.                                 expressionEditor "EE" $objList[0] $attrList[0];
  79.                             }
  80.                         }        
  81.                     }
  82.                 }
  83.             }
  84.             break;
  85.         case "-driven":
  86.             {
  87.                 string $objList[] = `channelBox -q -mainObjectList mainChannelBox`;
  88.                 string $attrList[] = `channelBox -q -selectedMainAttributes mainChannelBox`;
  89.  
  90.                 if ( size($objList) > 0 && size($attrList) > 0 ){
  91.                     setDrivenKeyWindow $objList[0] "";
  92.  
  93.                 } else {
  94.                     $objList = `channelBox -q -shapeObjectList mainChannelBox`;
  95.                     $attrList = `channelBox -q -selectedShapeAttributes mainChannelBox`;
  96.  
  97.                     if ( size($objList) > 0 && size($attrList) > 0 ){
  98.                         setDrivenKeyWindow $objList[0] "";
  99.  
  100.                     } else {
  101.                         $objList = `channelBox -q -historyObjectList mainChannelBox`;
  102.                         $attrList = `channelBox -q -selectedHistoryAttributes mainChannelBox`;
  103.  
  104.                         if ( size($objList) > 0 && size($attrList) > 0 ){
  105.                             setDrivenKeyWindow $objList[0] "";
  106.                         } else {
  107.                             $objList = `channelBox -q -outputObjectList mainChannelBox`;
  108.                             $attrList = `channelBox -q -selectedOutputAttributes mainChannelBox`;
  109.  
  110.                             if ( size($objList) > 0 && size($attrList) > 0 ){
  111.                                 setDrivenKeyWindow $objList[0] "";
  112.                             }
  113.                         }
  114.                     }
  115.                 }
  116.             }
  117.             break;
  118.         case "-cut":
  119.             {
  120.                 string $objList[] = `channelBox -q -mainObjectList mainChannelBox`;
  121.                 string $attrList[] = `channelBox -q -selectedMainAttributes mainChannelBox`;
  122.  
  123.                 string $cmd = "";
  124.                 int $okay = 0;
  125.  
  126.                 if ( size($objList) > 0 && size($attrList) > 0 ){
  127.                     $cmd = $cmd + "cutKey -t \":\" -f \":\"";
  128.                     for( $channel in $attrList )
  129.                         $cmd = $cmd + " -at \"" + $channel+"\"";
  130.                     for ( $object in $objList )
  131.                         $cmd = $cmd + " " + $object;
  132.                     $cmd = $cmd + ";\n";
  133.                     $okay = 1;
  134.                 }
  135.  
  136.                 $objList = `channelBox -q -shapeObjectList mainChannelBox`;
  137.                 $attrList = `channelBox -q -selectedShapeAttributes mainChannelBox`;
  138.  
  139.                 if ( size($objList) > 0 && size($attrList) > 0 ){
  140.                     $cmd = $cmd + "cutKey -t \":\" -f \":\"";
  141.                     for( $channel in $attrList )
  142.                         $cmd = $cmd + " -at \"" + $channel+"\"";
  143.                     for ( $object in $objList )
  144.                         $cmd = $cmd + " " + $object;
  145.                     $cmd = $cmd + ";\n";
  146.                     $okay = 1;
  147.                 }
  148.  
  149.                 $objList = `channelBox -q -historyObjectList mainChannelBox`;
  150.                 $attrList = `channelBox -q -selectedHistoryAttributes mainChannelBox`;
  151.  
  152.                 if ( size($objList) > 0 && size($attrList) > 0 ){
  153.                     $cmd = $cmd + "cutKey -t \":\" -f \":\"";
  154.                     for( $channel in $attrList )
  155.                         $cmd = $cmd + " -at \"" + $channel+"\"";
  156.                     for ( $object in $objList )
  157.                         $cmd = $cmd + " " + $object;
  158.                     $cmd = $cmd + ";\n";
  159.                     $okay = 1;
  160.                 }
  161.  
  162.                 $objList = `channelBox -q -outputObjectList mainChannelBox`;
  163.                 $attrList = `channelBox -q -selectedOutputAttributes mainChannelBox`;
  164.  
  165.                 if ( size($objList) > 0 && size($attrList) > 0 ){
  166.                     $cmd = $cmd + "cutKey -t \":\" -f \":\"";
  167.                     for( $channel in $attrList )
  168.                         $cmd = $cmd + " -at \"" + $channel+"\"";
  169.                     for ( $object in $objList )
  170.                         $cmd = $cmd + " " + $object;
  171.                     $cmd = $cmd + ";\n";
  172.                     $okay = 1;
  173.                 }
  174.  
  175.                 if ( $okay == 1 ){
  176.                     evalEcho( $cmd );
  177.                 }
  178.             }
  179.             break;
  180.         case "-copy":
  181.             {
  182.                 string $objList[] = `channelBox -q -mainObjectList mainChannelBox`;
  183.                 string $attrList[] = `channelBox -q -selectedMainAttributes mainChannelBox`;
  184.  
  185.                 string $cmd = "";
  186.                 int $okay = 0;
  187.  
  188.                 if ( size($objList) > 0 && size($attrList) > 0 ){
  189.                     $cmd = $cmd + "copyKey -t \":\" -f \":\"";
  190.                     for( $channel in $attrList )
  191.                         $cmd = $cmd + " -at \"" + $channel+"\"";
  192.                     for ( $object in $objList )
  193.                         $cmd = $cmd + " " + $object;
  194.                     $cmd = $cmd + ";\n";
  195.                     $okay = 1;
  196.                 }
  197.  
  198.                 $objList = `channelBox -q -shapeObjectList mainChannelBox`;
  199.                 $attrList = `channelBox -q -selectedShapeAttributes mainChannelBox`;
  200.  
  201.                 if ( size($objList) > 0 && size($attrList) > 0 ){
  202.                     $cmd = $cmd + "copyKey -t \":\" -f \":\"";
  203.                     for( $channel in $attrList )
  204.                         $cmd = $cmd + " -at \"" + $channel+"\"";
  205.                     for ( $object in $objList )
  206.                         $cmd = $cmd + " " + $object;
  207.                     $cmd = $cmd + ";\n";
  208.                     $okay = 1;
  209.                 }
  210.  
  211.                 $objList = `channelBox -q -historyObjectList mainChannelBox`;
  212.                 $attrList = `channelBox -q -selectedHistoryAttributes mainChannelBox`;
  213.  
  214.                 if ( size($objList) > 0 && size($attrList) > 0 ){
  215.                     $cmd = $cmd + "copyKey -t \":\" -f \":\"";
  216.                     for( $channel in $attrList )
  217.                         $cmd = $cmd + " -at \"" + $channel+"\"";
  218.                     for ( $object in $objList )
  219.                         $cmd = $cmd + " " + $object;
  220.                     $cmd = $cmd + ";\n";
  221.                     $okay = 1;
  222.                 }
  223.  
  224.                 $objList = `channelBox -q -outputObjectList mainChannelBox`;
  225.                 $attrList = `channelBox -q -selectedOutputAttributes mainChannelBox`;
  226.  
  227.                 if ( size($objList) > 0 && size($attrList) > 0 ){
  228.                     $cmd = $cmd + "copyKey -t \":\" -f \":\"";
  229.                     for( $channel in $attrList )
  230.                         $cmd = $cmd + " -at \"" + $channel+"\"";
  231.                     for ( $object in $objList )
  232.                         $cmd = $cmd + " " + $object;
  233.                     $cmd = $cmd + ";\n";
  234.                     $okay = 1;
  235.                 }
  236.  
  237.                 if ( $okay == 1 ){
  238.                     evalEcho( $cmd );
  239.                 }
  240.             }
  241.             break;
  242.         case "-paste":
  243.             {
  244.                 string $objList[] = `channelBox -q -mainObjectList mainChannelBox`;
  245.                 string $attrList[] = `channelBox -q -selectedMainAttributes mainChannelBox`;
  246.  
  247.                 string $cmd = "";
  248.                 int $okay = false;
  249.                 float $currentTime = `currentTime -query`;
  250.                 string $pasteKey = ("pasteKey -connect true -time " + $currentTime);
  251.  
  252.                 if ( size($objList) > 0 && size($attrList) > 0 ){
  253.                     $cmd = $cmd + $pasteKey;
  254.                     for( $channel in $attrList )
  255.                         $cmd = $cmd + " -at \"" + $channel+"\"";
  256.                     for ( $object in $objList )
  257.                         $cmd = $cmd + " " + $object;
  258.                     $cmd = $cmd + ";\n";
  259.                     $okay = true;
  260.                 }
  261.  
  262.                 $objList = `channelBox -q -shapeObjectList mainChannelBox`;
  263.                 $attrList = `channelBox -q -selectedShapeAttributes mainChannelBox`;
  264.  
  265.                 if ( size($objList) > 0 && size($attrList) > 0 ){
  266.                     $cmd = $cmd + $pasteKey;
  267.                     for( $channel in $attrList )
  268.                         $cmd = $cmd + " -at \"" + $channel+"\"";
  269.                     for ( $object in $objList )
  270.                         $cmd = $cmd + " " + $object;
  271.                     $cmd = $cmd + ";\n";
  272.                     $okay = true;
  273.                 }
  274.  
  275.                 $objList = `channelBox -q -historyObjectList mainChannelBox`;
  276.                 $attrList = `channelBox -q -selectedHistoryAttributes mainChannelBox`;
  277.  
  278.                 if ( size($objList) > 0 && size($attrList) > 0 ){
  279.                     $cmd = $cmd + $pasteKey;
  280.                     for( $channel in $attrList )
  281.                         $cmd = $cmd + " -at \"" + $channel+"\"";
  282.                     for ( $object in $objList )
  283.                         $cmd = $cmd + " " + $object;
  284.                     $cmd = $cmd + ";\n";
  285.                     $okay = true;
  286.                 }
  287.  
  288.                 $objList = `channelBox -q -outputObjectList mainChannelBox`;
  289.                 $attrList = `channelBox -q -selectedOutputAttributes mainChannelBox`;
  290.  
  291.                 if ( size($objList) > 0 && size($attrList) > 0 ){
  292.                     $cmd = $cmd + $pasteKey;
  293.                     for( $channel in $attrList )
  294.                         $cmd = $cmd + " -at \"" + $channel+"\"";
  295.                     for ( $object in $objList )
  296.                         $cmd = $cmd + " " + $object;
  297.                     $cmd = $cmd + ";\n";
  298.                     $okay = true;
  299.                 }
  300.  
  301.                 if ( $okay ){
  302.                     evalEcho( $cmd );
  303.                 }
  304.             }
  305.             break;
  306.         case "-delete":
  307.             {
  308.                 string $objList[] = `channelBox -q -mainObjectList mainChannelBox`;
  309.                 string $attrList[] = `channelBox -q -selectedMainAttributes mainChannelBox`;
  310.  
  311.                 string $cmd = "";
  312.                 int $okay = 0;
  313.  
  314.                 if ( size($objList) > 0 && size($attrList) > 0 ){
  315.                     $cmd = $cmd + "cutKey -cl -t \":\" -f \":\"";
  316.                     for( $channel in $attrList )
  317.                         $cmd = $cmd + " -at \"" + $channel+"\"";
  318.                     for ( $object in $objList )
  319.                         $cmd = $cmd + " " + $object;
  320.                     $cmd = $cmd + ";\n";
  321.                     $okay = 1;
  322.                 }
  323.  
  324.                 $objList = `channelBox -q -shapeObjectList mainChannelBox`;
  325.                 $attrList = `channelBox -q -selectedShapeAttributes mainChannelBox`;
  326.  
  327.                 if ( size($objList) > 0 && size($attrList) > 0 ){
  328.                     $cmd = $cmd + "cutKey -cl -t \":\" -f \":\"";
  329.                     for( $channel in $attrList )
  330.                         $cmd = $cmd + " -at \"" + $channel+"\"";
  331.                     for ( $object in $objList )
  332.                         $cmd = $cmd + " " + $object;
  333.                     $cmd = $cmd + ";\n";
  334.                     $okay = 1;
  335.                 }
  336.  
  337.                 $objList = `channelBox -q -historyObjectList mainChannelBox`;
  338.                 $attrList = `channelBox -q -selectedHistoryAttributes mainChannelBox`;
  339.  
  340.                 if ( size($objList) > 0 && size($attrList) > 0 ){
  341.                     $cmd = $cmd + "cutKey -cl -t \":\" -f \":\"";
  342.                     for( $channel in $attrList )
  343.                         $cmd = $cmd + " -at \"" + $channel+"\"";
  344.                     for ( $object in $objList )
  345.                         $cmd = $cmd + " " + $object;
  346.                     $cmd = $cmd + ";\n";
  347.                     $okay = 1;
  348.                 }
  349.  
  350.                 $objList = `channelBox -q -outputObjectList mainChannelBox`;
  351.                 $attrList = `channelBox -q -selectedOutputAttributes mainChannelBox`;
  352.  
  353.                 if ( size($objList) > 0 && size($attrList) > 0 ){
  354.                     $cmd = $cmd + "cutKey -cl -t \":\" -f \":\"";
  355.                     for( $channel in $attrList )
  356.                         $cmd = $cmd + " -at \"" + $channel+"\"";
  357.                     for ( $object in $objList )
  358.                         $cmd = $cmd + " " + $object;
  359.                     $cmd = $cmd + ";\n";
  360.                     $okay = 1;
  361.                 }
  362.  
  363.                 if ( $okay == 1 ){
  364.                     evalEcho( $cmd );
  365.                 }
  366.             }
  367.             break;
  368.         case "-deleteAttributes":
  369.             channelBox -e -exe "catch (`deleteAttr -attribute \"#A\" \"#P\"`);" true mainChannelBox;
  370.             break;
  371.         case "-precision":
  372.             {
  373.                 int $oldPrecision = `optionVar -query channelsPrecision`;
  374.                 int $newPrecision = precisionPrompt ("", $oldPrecision, 15);
  375.                 if ($newPrecision > 0) {
  376.                     
  377.                     // Change the width of the fields depending on the
  378.                     // precision.
  379.                     //
  380.                     int $oldWidth = `channelBox -q -fieldWidth mainChannelBox`;
  381.                     int $newWidth;
  382.                     if ($newPrecision <= 3) {
  383.                         $newWidth = 65;
  384.                     } else if ($newPrecision <= 6) {
  385.                         $newWidth = 95;
  386.                     } else if ($newPrecision <= 9) {
  387.                         $newWidth = 115;
  388.                     } else if ($newPrecision <= 12) {
  389.                         $newWidth = 130;
  390.                     } else {
  391.                         $newWidth = 155;                        
  392.                     }
  393.                     channelBox -e -pre $newPrecision 
  394.                         -fieldWidth $newWidth 
  395.                         mainChannelBox;
  396.                     optionVar -iv channelsPrecision $newPrecision;
  397.                     optionVar -iv channelsFieldWidth $newWidth;
  398.                     
  399.                     nudgeChannelsLayersWidth($newWidth-$oldWidth);
  400.                 }
  401.             }
  402.             break;
  403.         case "-break":
  404.             channelBox -e -exe "CBdeleteConnection \"#P.#A\";" true mainChannelBox;
  405.             break;
  406.         case "-reset":
  407.             global int $gChannelsLayersWidth;
  408.             optionVar -iv channelsLongName 1;   // 1=nice
  409.             optionVar -iv channelsPrecision 3;
  410.             optionVar -iv channelsFieldWidth 65;
  411.             $gChannelsLayersWidth = 180;
  412.             channelBox -e -ln true -nn true
  413.                 -precision 3 -fieldWidth 65 mainChannelBox;
  414.             setChannelsLayersWidth ($gChannelsLayersWidth);
  415.             checkSpeedButton "medium" true;
  416.             channelBox -e -hyperbolic false mainChannelBox;
  417.             channelBox -e -useManips "standard" mainChannelBox;
  418.             initChannelBoxButtons;
  419.             break;
  420.     }
  421. }
  422.  
  423.  
  424. global proc CBunlockAttr( string $plugName )
  425. //
  426. // If this plug or any of its ancestors is locked,
  427. // unlock it.
  428. //
  429. {
  430.     string $lockedPlug = `connectionInfo -gla $plugName`;
  431.     if ( $lockedPlug != "" ){
  432.         setAttr -lock false $lockedPlug;
  433.     }
  434. }
  435.  
  436.  
  437. global proc CBdeleteConnection( string $destName )
  438. //
  439. // If the specified name is the destination of a connection,
  440. // then delete that connection.
  441. //
  442. {
  443.     if ( `connectionInfo -isDestination $destName` ){
  444.         string $destination = `connectionInfo -getExactDestination $destName`;
  445.  
  446.         // When deleting a src connection from a character, you must remove
  447.         // the item from the character set or the character will no longer
  448.         // work consistently: bug 127212
  449.         //
  450.         string $srcConn[] = `listConnections -s 1 -d 0 -type character $destination`;
  451.         if (size($srcConn)) {
  452.             string $warnMsg = ("Removed \'"+$destination+"\' from character \'"+$srcConn[0]+"\'.");
  453.             warning($warnMsg);
  454.             character -e -rm $srcConn[0] $destination;
  455.         }
  456.         
  457.         // delete -icn doesn't work if destination attr is readOnly 
  458.         // so use disconnectAttr in this case
  459.         //
  460.         string $sArr[1] = `ls -ro $destination`;
  461.         if (size($sArr)) {
  462.             string $src = `connectionInfo -sourceFromDestination $destination`;
  463.             disconnectAttr $src $destination;
  464.         } else {
  465.             delete -icn $destination;
  466.         }
  467.     }
  468. }
  469.  
  470.  
  471. global proc int selectedChannels( )
  472. //
  473. //    Checks to see if any channels in the channel box
  474. //    are selected, and returns an int 0/1 depending
  475. //    on whether channels are selected or not
  476. {
  477.     string $objList[] = `channelBox -q -mainObjectList mainChannelBox`;
  478.     string $attrList[] = `channelBox -q -selectedMainAttributes mainChannelBox`;
  479.  
  480.     if ( size($objList) > 0 && size($attrList) > 0 ){
  481.         return 1;
  482.     }
  483.  
  484.     $objList= `channelBox -q -shapeObjectList mainChannelBox`;
  485.     $attrList= `channelBox -q -selectedShapeAttributes mainChannelBox`;
  486.  
  487.     if ( size($objList) > 0 && size($attrList) > 0 ){
  488.         return 1;
  489.  
  490.     }
  491.  
  492.     $objList= `channelBox -q -historyObjectList mainChannelBox`;
  493.     $attrList= `channelBox -q -selectedHistoryAttributes mainChannelBox`;
  494.  
  495.     if ( size($objList) > 0 && size($attrList) > 0 ){
  496.         return 1;
  497.     }
  498.  
  499.     $objList= `channelBox -q -outputObjectList mainChannelBox`;
  500.     $attrList= `channelBox -q -selectedOutputAttributes mainChannelBox`;
  501.  
  502.     if ( size($objList) > 0 && size($attrList) > 0 ){
  503.         return 1;
  504.     }
  505.  
  506.     return 0;
  507. }
  508.  
  509.  
  510. global proc enableDisableChannelMenu( string $parent )
  511. //
  512. // Enables or disables menu items in the channelBox
  513. // menus, based on whether channels are selected or
  514. // not.
  515. {
  516.     int $channelsSelected = `selectedChannels`;
  517.  
  518.     menuItem -e -enable $channelsSelected ( $parent + "|keyItem" );
  519.     menuItem -e -enable $channelsSelected ( $parent + "|breakdownItem" );
  520.     menuItem -e -enable $channelsSelected ( $parent + "|muteItem" );
  521.     menuItem -e -enable $channelsSelected ( $parent + "|unmuteItem" );        
  522.     menuItem -e -enable $channelsSelected ( $parent + "|copyItem" );
  523.     menuItem -e -enable $channelsSelected ( $parent + "|cutItem" );
  524.     menuItem -e -enable $channelsSelected ( $parent + "|pasteItem" );
  525.     menuItem -e -enable $channelsSelected ( $parent + "|deleteItem" );
  526.     menuItem -e -enable $channelsSelected ( $parent + "|lockItem" );
  527.     menuItem -e -enable $channelsSelected ( $parent + "|unlockItem" );
  528.     menuItem -e -enable $channelsSelected ( $parent + "|exprItem" );
  529.     menuItem -edit -enable $channelsSelected ($parent + "|deleteAttrItem");
  530.     menuItem -e -enable $channelsSelected ( $parent + "|breakItem" );
  531.     menuItem -e -enable $channelsSelected ( $parent + "|drivenItem" );
  532. }
  533.  
  534. global proc generateChannelMenu( string $parent, int $popupMenu )
  535. //
  536. // Generates the menu on both the menubar and on
  537. // the RMB, when the user asks for either of these.
  538. // After building, this proc keeps the state of the
  539. // longname/shortname checkbox up to date whenever
  540. // the menu is popped again.
  541. //
  542. {
  543.     setParent -m $parent;
  544.  
  545.     if( 0 != `menu -q -ni $parent` ) {
  546.         //
  547.         // The menu already exists - just set the
  548.         // enable/disable state for
  549.         // each of the menuItems that operation on
  550.         // selected channels.
  551.         //
  552.         enableDisableChannelMenu $parent;
  553.  
  554.         // Make sure the name state is correct.
  555.         // It can be changed without using the menu.
  556.         //
  557.         menuItem -edit
  558.             -radioButton ( 1 == `optionVar -query channelsLongName` )
  559.             niceNameItem;
  560.         menuItem -edit
  561.             -radioButton ( 2 == `optionVar -query channelsLongName` )
  562.             longNameItem;
  563.         menuItem -edit
  564.             -radioButton ( 0 == `optionVar -query channelsLongName` )
  565.             shortNameItem;
  566.     } else {
  567.         //
  568.         // The menu doesn't exist yet - build it
  569.         //
  570.         if( $popupMenu ) {
  571.             //
  572.             //    A popup menu is being generated - attach
  573.             //    a label to the top of the popup
  574.             //
  575.             menuItem -l "Channels";
  576.             menuItem -d true;
  577.             menuItem -d true;
  578.         }
  579.         menuItem -l "Key Selected" -c "channelBoxCommand -key" keyItem;
  580.         menuItem -l "Key All" -c "channelBoxCommand -keyall" keyAllItem;
  581.         menuItem -l "Breakdown Selected" -c "channelBoxCommand -breakdown" breakdownItem;
  582.         menuItem -l "Breakdown All" -c "channelBoxCommand -breakdownall" breakdownAllItem;
  583.         menuItem -l "Mute Selected" -c "channelBoxCommand -mute" muteItem;
  584.         menuItem -l "Mute All" -c "channelBoxCommand -muteall" muteAllItem;
  585.         menuItem -l "Unmute Selected" -c "channelBoxCommand -unmute" unmuteItem;
  586.         menuItem -l "Unmute All" -c "channelBoxCommand -unmuteall" unmuteAllItem;
  587.  
  588.         menuItem -d true;
  589.  
  590.         menuItem -l "Cut Selected" -c "channelBoxCommand -cut" cutItem;
  591.         menuItem -l "Copy Selected" -c "channelBoxCommand -copy" copyItem;
  592.         menuItem -l "Paste Selected" -c "channelBoxCommand -paste" pasteItem;
  593.         menuItem -l "Delete Selected" -c "channelBoxCommand -delete" deleteItem;
  594.  
  595.         menuItem -d true;
  596.  
  597.         menuItem -l "Break Connections" -c "channelBoxCommand -break" breakItem;
  598.  
  599.         menuItem -d true;
  600.  
  601.         menuItem -l "Lock Selected" -c "channelBoxCommand -lock" lockItem;
  602.         menuItem -l "Unlock Selected" -c "channelBoxCommand -unlock" unlockItem;
  603.  
  604.         menuItem -divider true;
  605.  
  606.         menuItem -l "Expressions..." -c "channelBoxCommand -expression" exprItem;
  607.         menuItem -l "Set Driven Key..." -c "channelBoxCommand -driven" drivenItem;
  608.  
  609.         menuItem -divider true;
  610.  
  611.         menuItem -label "Delete Attributes"
  612.             -command "channelBoxCommand -deleteAttributes"
  613.             deleteAttrItem;
  614.  
  615.         menuItem -divider true;
  616.  
  617.         string $menu = `menuItem -l "Settings" -subMenu true`;
  618.             menu -e -pmc ( "buildChannelBoxOptionMenu " + $menu ) $menu;
  619.         setParent -m ..;
  620.  
  621.         menuItem -l "Channel Names" -subMenu true;
  622.             radioMenuItemCollection;
  623.             menuItem -l "Nice"
  624.                 -radioButton ( 1 == `optionVar -query channelsLongName` )
  625.                 -c "setChannelLongName 1"
  626.                 niceNameItem;
  627.             menuItem -l "Long"
  628.                 -radioButton ( 2 == `optionVar -query channelsLongName` )
  629.                 -c "setChannelLongName 2"
  630.                 longNameItem;
  631.             menuItem -l "Short"
  632.                 -radioButton ( 0 == `optionVar -query channelsLongName` )
  633.                 -c "setChannelLongName 0"
  634.                 shortNameItem;
  635.             setParent -m ..;
  636.  
  637.         enableDisableChannelMenu $parent;
  638.     }
  639. }
  640.  
  641. global proc buildChannelBoxOptionMenu( string $parent ) {
  642. //
  643. //    Builds the menu containing the options for various
  644. //    settings in the channel box.
  645. //
  646.     
  647.     setParent -m $parent;
  648.     menu -e -dai $parent;
  649.  
  650.     radioMenuItemCollection;
  651.     menuItem -l "Slow" 
  652.         -radioButton (0.1 == `channelBox -q -speed mainChannelBox`)
  653.         -c "channelBoxSettings slow #1";
  654.     menuItem -l "Medium" 
  655.         -radioButton (1.0 == `channelBox -q -speed mainChannelBox`)
  656.         -c "channelBoxSettings medium #1";
  657.     menuItem -l "Fast" 
  658.         -radioButton (10.0 == `channelBox -q -speed mainChannelBox`)
  659.         -c "channelBoxSettings fast #1";
  660.     menuItem -d true;
  661.     menuItem -l "Hyperbolic" 
  662.         -checkBox `channelBox -q -hyperbolic mainChannelBox`
  663.         -c "channelBoxSettings hyperbolic #1";
  664.     menuItem -d true;
  665.  
  666.     radioMenuItemCollection;
  667.     menuItem -l "No Manips" 
  668.         -radioButton ("none" == `channelBox -q -useManips mainChannelBox` )
  669.         -c "channelBoxSettings useManips 0";
  670.     menuItem -l "Invisible Manips" 
  671.         -radioButton ("invisible" == `channelBox -q -useManips mainChannelBox` )
  672.         -c "channelBoxSettings useManips 1";
  673.     menuItem -l "Standard Manips" 
  674.         -radioButton ("standard" == `channelBox -q -useManips mainChannelBox` )
  675.         -c "channelBoxSettings useManips 2";
  676.     menuItem -d true;
  677.  
  678.     menuItem -label "Change Precision..." 
  679.         -command "channelBoxCommand -precision";
  680.  
  681.     menuItem -label "Reset to Default" 
  682.         -command "channelBoxCommand -reset";
  683. }
  684.